﻿<%@ Page Title="FP : Formula" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="FormulasPage.aspx.cs" Inherits="FlexiPay.FormulaPage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="FormulaHelper.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="LableTitle" runat="server" Font-Bold="true" Font-Size="Medium" ForeColor="Black"></asp:Label>
    <asp:HiddenField ID="currentControl" runat="server" />
    <table border="1px" style="vertical-align: middle; border-style: none">
        <tr>
            <td align="left" valign="top" style="width: 20%" rowspan="3">
                <asp:ListBox ID="LBLHSFormula" runat="server" Rows="30" Width="100%" DataTextField="Name"
                    DataValueField="RowNo" OnSelectedIndexChanged="LBLHSFormula_SelectedIndexChanged"
                    AutoPostBack="True" DataSourceID="SDSFormula" OnDataBinding="LBLHSFormula_DataBinding">
                </asp:ListBox>
                <asp:SqlDataSource ID="SDSFormula" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="LabelFormulaName" runat="server" Text="Name" Width="100px"></asp:Label>
                <asp:TextBox ID="TBFormulaName" Width="400px" runat="server"></asp:TextBox>
                <br />
                <br />
                <asp:Label ID="LabelSubType" runat="server" Text="SubType" Width="100px"></asp:Label>
                <asp:DropDownList ID="DDLSubType" runat="server" AutoPostBack="True" DataSourceID="SDSSubType"
                    OnSelectedIndexChanged="DDLSubType_SelectedIndexChanged" DataTextField="Value"
                    DataValueField="Value" Width="150px" OnDataBinding="DDLSubType_DataBinding">
                </asp:DropDownList>
                &nbsp;&nbsp;&nbsp;
                <asp:Label ID="LabelReturnType" runat="server" Text="Return Type" Width="100px"></asp:Label>
                <asp:DropDownList ID="DDLReturnType" runat="server" DataSourceID="SDSReturnType" DataTextField="Value"
                    DataValueField="Value" Width="140px" OnDataBinding="DDLReturnType_DataBinding">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SDSReturnType" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SDSSubType" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>">
                </asp:SqlDataSource>
                <br />
                <table>
                    <tr>
                        <td>
                            <asp:Label ID="LabelFromDate" runat="server" Text="From Date :" Width="95px"></asp:Label>
                            <asp:TextBox ID="TBFromDate" runat="server" Width="150px"></asp:TextBox>
                            <ajax:CalendarExtender ID="CalendarFromDate" runat="server" PopupButtonID="TBFromDate"
                                TargetControlID="TBFromDate" Format="yyyy-MM-dd">
                            </ajax:CalendarExtender>
                        </td>
                        <td>
                            &nbsp;&nbsp;&nbsp;<asp:Label ID="LabelToDate" runat="server" Text="To Date :" Width="75px"></asp:Label>
                            <asp:TextBox ID="TBToDate" runat="server" Width="150px"></asp:TextBox>
                            <ajax:CalendarExtender ID="CalendarToDate" runat="server" PopupButtonID="TBToDate"
                                TargetControlID="TBToDate" Format="yyyy-MM-dd">
                            </ajax:CalendarExtender>
                        </td>
                    </tr>
                </table>
                <br />
                <asp:Label ID="LabelWhen" runat="server" Text="Conditional Part" Width="100px" Height="50px"></asp:Label>
                <asp:TextBox Rows="4" runat="server" Width="400px" ID="TBWhenPart" TextMode="MultiLine"
                    onclick='return setCurrentControl("MainContent_TBWhenPart","MainContent_currentControl")'></asp:TextBox>
                <br />
                <asp:Label ID="LabelThen" runat="server" Text="Payout Part" Width="100px" Height="50px"></asp:Label>
                <asp:TextBox Rows="4" runat="server" Width="400px" ID="TBThenPart" TextMode="MultiLine"
                    onclick='return setCurrentControl("MainContent_TBThenPart","MainContent_currentControl")'></asp:TextBox>
                <br />
                <asp:Label ID="LabelGroupBy" runat="server" Text="Group By" Width="100px"></asp:Label>
                <asp:TextBox ID="TBGroupBy" onclick='return setCurrentControl("MainContent_TBGroupBy","MainContent_currentControl")'
                    runat="server" Width="400px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            <asp:Label ID="LabelFunctionList" runat="server" Text="Function List" Width="110px"></asp:Label>
                            <asp:Label ID="LabelFormulaList" runat="server" Text="Formula List" Width="150px"></asp:Label>
                            <asp:Label ID="LabelFieldList" runat="server" Text="Field List" Width="200px"></asp:Label>
                            <asp:Label ID="LabelSlabsList" runat="server" Text="Slabs List" Width="150px"></asp:Label>
                            <br />
                            <asp:ListBox ID="LBListFunction" Rows="9" runat="server" Width="110px" OnLoad="LBListFunction_Load"
                                DataValueField="Value" onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                            <asp:ListBox ID="LBListFormula" Rows="9" runat="server" Width="150px" DataValueField="Value"
                                onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                            <asp:ListBox ID="LBListColumn" Rows="9" runat="server" Width="200px" OnLoad="LBListField_Load"
                                DataValueField="Value" onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                            <asp:ListBox ID="LBListSlabs" Rows="9" runat="server" Width="150px" OnLoad="LBListSlabs_Load"
                                DataValueField="Value" onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                        </td>
                        <td>
                            <asp:Label ID="LabelOperatorList" runat="server" Text="Operators :" Width="150px"></asp:Label>
                            <table class="buttonList" cellpadding="0" cellspacing="1" style="width: 100px;">
                                <tr>
                                    <td>
                                        <input class="smallbutton" type="button" value="AND" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="OR" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="NOT" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="," style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input class="smallbutton" type="button" value="+" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="-" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="*" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="/" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input class="smallbutton" type="button" value="(" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value=")" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="=" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="<>" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input class="smallbutton" type="button" value="<" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value=">" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="&lt;=" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                    <td>
                                        <input class="smallbutton" type="button" value="=>" style="width: 45px; height: 35px;"
                                            onclick='return appendTextValue(this.value,"MainContent_currentControl");' />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center" valign="middle" colspan="2">
                <asp:Button ID="BApply" runat="server" Text="Apply" Width="100px" OnClick="BApply_Click" />
                <asp:Button ID="BCreate" runat="server" Text="Create New" Width="100px" OnClick="BCreate_Click" />
                &nbsp;<asp:Button ID="BCancel" runat="server" Text="Cancel" Width="100px" OnClick="BCancel_Click" />
                <asp:Button ID="BEdit" runat="server" Text="Edit" Width="100px" OnClick="BEdit_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
